package utils

import (
	"fmt"
	"strconv"
	"strings"
)

func Zh2Unicode(cn string) string {
	textQuoted := strconv.QuoteToASCII(cn)
	textUnquoted := textQuoted[1 : len(textQuoted)-1]
	fmt.Println(textUnquoted)
	return textUnquoted
}

func Unicode2Zh(raw []byte) ([]byte, error) {
	str, err := strconv.Unquote(strings.Replace(strconv.Quote(string(raw)), `\\u`, `\u`, -1))
	if err != nil {
		return nil, err
	}
	return []byte(str), nil
}
